package gui;

import java.util.Observable;

import templates.Tower;
import templates.TowerTemplate;

public class Selection extends Observable {

	public static final int BUY = 100;
	public static final int TOWER = 101;
	
	private int type=100;
	private Tower tower=new Tower();
	private TowerTemplate template;

	public Tower getTower() {
		return type==TOWER? tower: null;
	}
	public TowerTemplate getTemplate() {
		return type==BUY? template: null;
	}
	
	public int type() {
		return type;
	}

	public void set(Tower tower) {
		set(tower, TOWER);
	}
	public void set(Tower tower, int type) {
		this.type=type;
		this.tower = tower;
		this.template = tower.getTemplate();
		this.setChanged();
		this.notifyObservers();
	}

	public void set(TowerTemplate t) {
		type = BUY;
		template = t;
		this.setChanged();
		this.notifyObservers();
	}

}
